<template>
  <el-select :value="value" :placeholder="placeholder" class="am-w-full"
             :multiple="multiple"
             @change="handleChange">
    <el-option v-for="item in options" :key="item.id"
               :label="item.name" :value="item.id" />
  </el-select>
</template>

<script>
import {listAllAmGroup} from "../../../api/am/amGroup";

export default {
  props: {
    value: [String, Number, Array],
    multiple: Boolean,
    placeholder: {
      type: String,
      default: '请选择',
    },
  },
  data() {
    return {
      options: []
    }
  },
  methods: {
    handleChange(value) {
      this.$emit('input', value)
    }
  },
  created() {
    listAllAmGroup().then(response => {
      this.options = response.data;
    })
  }
}
</script>
